package com.load.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by 78397 on 2019/11/11.
 */
@ComponentScan
@Configuration
public class WebConfigurer extends WebMvcConfigurerAdapter {

    @Autowired
    UpLoadPathConfig upLoadPathConfig;


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/image/**").addResourceLocations("file:///"+upLoadPathConfig.getUploadImgPath());
        registry.addResourceHandler("/file/**").addResourceLocations("file:///"+upLoadPathConfig.getUploadFilePath());
    }
}
